<?php

class m130807_163053_create_table_shops extends CDbMigration
{
	public function up()
	{
		$this->createTable('{{shops}}',array(
			'id'=>'pk',
			'name'=>'VARCHAR(255) NOT NULL',
			'organization_id'=>'INT(11) NOT NULL',
			'address'=>'TEXT',
			'active'=>'INT(1) NOT NULL DEFAULT 1'
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 1.1',
			'organization_id'=>1
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 1.2',
			'organization_id'=>1
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 1.3',
			'organization_id'=>1
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 2.1',
			'organization_id'=>2
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 2.2',
			'organization_id'=>2
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 2.3',
			'organization_id'=>2
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 3.1',
			'organization_id'=>3
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 3.2',
			'organization_id'=>3
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 4.1',
			'organization_id'=>4
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 5.1',
			'organization_id'=>5
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 5.2',
			'organization_id'=>5
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 5.3',
			'organization_id'=>5
		));

		$this->insert('{{shops}}',array(
			'name'=>'Shop 5.4',
			'organization_id'=>5
		));
	}

	public function down()
	{
		$this->dropTable('{{shops}}');
	}

	/*
	// Use safeUp/safeDown to do migration with transaction
	public function safeUp()
	{
	}

	public function safeDown()
	{
	}
	*/
}